﻿<UserControl x:Class="AdminModule.UserControls.Common.LogFilter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel>
            <Button VerticalAlignment="Center" x:Name="addFilter" Click="addFilter_Click" Content="Добавить фильтр"></Button>
            <ListBox MaxHeight="60" MinHeight="60" ScrollViewer.VerticalScrollBarVisibility="Auto" Visibility="Collapsed" Name="listBox">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <ComboBox Tag="{Binding}" x:Name="AttributeComboBox" SelectionChanged="AttributeComboBox_SelectionChanged" ToolTipService.ToolTip="Название атрибута" ItemsSource="{Binding Attributes}">
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock TextWrapping="Wrap" Text="{Binding AttributeName}"></TextBlock>
                                    </DataTemplate>
                                </ComboBox.ItemTemplate> 
                            </ComboBox>
                            <ComboBox Tag="{Binding}" x:Name="ConditionComboBox" SelectionChanged="ConditionComboBox_SelectionChanged" ToolTipService.ToolTip="Оператор" ItemsSource="{Binding Conditions, Mode=TwoWay}">
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock TextWrapping="Wrap" ToolTipService.ToolTip="{Binding ConditionToolTip}" Text="{Binding ConditionName}"></TextBlock>
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                            </ComboBox>
                            <TextBox Name="ValueTextBox" Visibility="Collapsed" Margin="3,0,0,0" MinWidth="100" Tag="{Binding}" TextChanged="TextBox_TextChanged" ToolTipService.ToolTip="Условие" Text="{Binding Condition}"></TextBox>
                            <ComboBox Name="ValueComboBox" Visibility="Collapsed" Margin="3,0,0,0" MinWidth="100" Tag="{Binding}" SelectionChanged="ValueComboBox_SelectionChanged">
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock TextWrapping="Wrap" Text="{Binding Name}"></TextBlock>
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                            </ComboBox>
                            <Button Margin="3,0,0,0" MinWidth="15" Tag="{Binding}" ToolTipService.ToolTip="Добавить условие" x:Name="addCondition" Click="addCondition_Click" Content="+"></Button>
                            <Button Margin="3,0,0,0" MinWidth="15" Tag="{Binding}" ToolTipService.ToolTip="Удалить условие" x:Name="removeCondition" Click="removeCondition_Click" Content="-"></Button>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </StackPanel>
    </Grid>
</UserControl>
